 /**
 * Description: 操作日志表
 * @author:HunterWu
 * @since:1.0.0
 *
 * Modification History:
 * Date         Author      Version     Description
 * ------------------------------------------------------------------
 * 2018-05-11   HunterWu       1.0.0     Initial
 */
package com.metro.activation.sys.service.impl;

import com.metro.core.dao.IMapper;
import com.metro.core.service.BaseServiceSupport;
import com.metro.core.service.ServiceException;
import com.metro.core.vo.ResultCode;
import com.metro.core.vo.inf.IResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.metro.activation.sys.mapper.ILogUserAccessMapper;
import com.metro.activation.sys.service.inf.ILogUserAccessService;
import com.metro.activation.sys.beans.vo.LogUserAccess;

 /**
 * 操作日志表<br>
 *
 * @author:HunterWu
 * @since:1.0.0
 * @version [1.0.0, 2018-05-11]
 */
@Service("loguseraccessService")
public class LogUserAccessService extends BaseServiceSupport<LogUserAccess> implements ILogUserAccessService{
    //操作日志表Mapper
    @Autowired
    private ILogUserAccessMapper loguseraccessMapper;

    @Override
    public IMapper getMapper() {
        return loguseraccessMapper;
    }

    @Override
    public IResult save(LogUserAccess entity) {
        try {
            loguseraccessMapper.save(entity);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("新增操作日志表失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult update(LogUserAccess entity) {
        try {
            loguseraccessMapper.update(entity);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("修改操作日志表失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult delete(Long id) {
        try {
            loguseraccessMapper.delete(id);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("删除失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult deleteByIds(String ids) {
        try {
            loguseraccessMapper.deleteByIds(ids);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("删除失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }
}